﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<JLL.China.Web.Areas.Portal.Models.MemberGroupModel>" %>
<!--  start step-holder -->
<div id="step-holder">
    <div class="step-no">
        1</div>
    <div class="step-dark-left">
        Group Detail</div>
    <div class="step-dark-Round">
        &nbsp;</div>
    <div class="clear">
    </div>
</div>
<!--  end step-holder -->
<!-- start id-form -->
<% using (Html.BeginForm("CreateMemberGroup", "Admin", FormMethod.Post, new { id = "formID", @class = "validateforms" }))
   { %>
<% = Html.HiddenFor(x => x.Group.MemberGroup_ID)%>
<table border="0" cellpadding="0" cellspacing="0" class="tbl-form">
    <!-- start admin profile -->
    <tr>
        <th valign="top" width="100px">
            <span class="mandate">*</span> Group Name:
        </th>
        <td>
            <%= Html.TextBoxFor(model => model.Group.GroupName, new { @class = "validate[required] inp-form" })%>
        </td>
        <td>
        </td>
    </tr>
    <tr>
        <td colspan="3">
            &nbsp;
        </td>
    </tr>
    <!-- start Modules List -->
    <tr>
        <th valign="top">
            Access Control:
        </th>
        <td>
            <div class="scrollbox">
                <ul>
                    <% 
                        for (int i = 0; i < this.Model.Modules.Count; i++)
                        {
                    %>
                    <li>
                        <% int check = 0;
                           if (this.Model.GroupModule != null)
                           {


                               for (int j = 0; j < this.Model.GroupModule.Count; j++)
                               {
                                   if (this.Model.Modules[i].Module_ID == this.Model.GroupModule[j].ModuleFID)
                                   {
                                       check = 1;
                                       break;
                                   }
                               }
                           } 
                        %>
                        <%if (check == 1)
                          { %>
                        <input type="checkbox" class="validate[minCheckbox[1]]" name="SelectedModules" value="<%= this.Model.Modules[i].Module_ID %>"
                            checked="checked" />
                        <% }
                          else
                          { %>
                        <input type="checkbox" class="validate[minCheckbox[1]]" name="SelectedModules" value="<%= this.Model.Modules[i].Module_ID %>" />
                        <% } %>
                        <%= this.Model.Modules[i].Name%>
                    </li>
                    <%  }%>
                </ul>
            </div>
            <a class="check" onclick="$(this).parent().find(':checkbox').attr('checked', true);">
                Select All</a> / <a class="check" onclick="$(this).parent().find(':checkbox').attr('checked', false);">
                    Unselect All</a>
        </td>
        <td>
        </td>
    </tr>
    <!-- end Modules List -->
    <tr>
        <td colspan="3">
            &nbsp;
        </td>
    </tr>
    <tr>
        <th>
            &nbsp;
        </th>
        <td valign="top">
            <input type="submit" value="Submit" onclick="checkForm();" class="buttons" style="margin-right: 8px;
                float: right" />
            <input type="reset" value="Reset" class="buttons" style="margin-right: 8px; float: right" />
        </td>
        <td style="width: 42%;">
        </td>
    </tr>
</table>
<%} %>
<!-- end id-form  -->
